Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,18 @@ client = Client("https://fffiloni-test-llama-api.hf.space/", hf_token=hf_token)
|
|
| 7 |
|
| 8 |
clipi_client = Client("https://fffiloni-clip-interrogator-2.hf.space/")
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
def infer(image_input):
|
| 12 |
|
|
@@ -32,6 +44,8 @@ def infer(image_input):
|
|
| 32 |
|
| 33 |
print(f"Llama2 result: {result}")
|
| 34 |
|
|
|
|
|
|
|
| 35 |
return clipi_result, result
|
| 36 |
|
| 37 |
css="""
|
|
|
|
| 7 |
|
| 8 |
clipi_client = Client("https://fffiloni-clip-interrogator-2.hf.space/")
|
| 9 |
|
| 10 |
+
def get_text_after_colon(input_text):
|
| 11 |
+
# Find the first occurrence of ":"
|
| 12 |
+
colon_index = input_text.find(":")
|
| 13 |
+
|
| 14 |
+
# Check if ":" exists in the input_text
|
| 15 |
+
if colon_index != -1:
|
| 16 |
+
# Extract the text after the colon
|
| 17 |
+
result_text = input_text[colon_index + 1:].strip()
|
| 18 |
+
return result_text
|
| 19 |
+
else:
|
| 20 |
+
# Return the original text if ":" is not found
|
| 21 |
+
return input_text
|
| 22 |
|
| 23 |
def infer(image_input):
|
| 24 |
|
|
|
|
| 44 |
|
| 45 |
print(f"Llama2 result: {result}")
|
| 46 |
|
| 47 |
+
result = get_text_after_colon(result)
|
| 48 |
+
|
| 49 |
return clipi_result, result
|
| 50 |
|
| 51 |
css="""
|