Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -30,6 +30,20 @@ def cut_audio(input_path, output_path, max_duration=30000):
|
|
| 30 |
|
| 31 |
return output_path
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
def solo_xd(prompt):
|
| 34 |
images = pipe(prompt=prompt).images[0]
|
| 35 |
return images
|
|
@@ -75,11 +89,10 @@ def infer(audio_file):
|
|
| 75 |
result = client.predict(
|
| 76 |
llama_q, # str in 'Message' Textbox component
|
| 77 |
api_name="/predict"
|
| 78 |
-
)
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
|
|
|
|
|
|
|
| 83 |
print(f"Llama2 result: {result}")
|
| 84 |
|
| 85 |
images = pipe(prompt=result).images[0]
|
|
|
|
| 30 |
|
| 31 |
return output_path
|
| 32 |
|
| 33 |
+
def get_text_after_colon(input_text):
|
| 34 |
+
# Find the first occurrence of ":"
|
| 35 |
+
colon_index = input_text.find(":")
|
| 36 |
+
|
| 37 |
+
# Check if ":" exists in the input_text
|
| 38 |
+
if colon_index != -1:
|
| 39 |
+
# Extract the text after the colon
|
| 40 |
+
result_text = input_text[colon_index + 1:].strip()
|
| 41 |
+
return result_text
|
| 42 |
+
else:
|
| 43 |
+
# Return the original text if ":" is not found
|
| 44 |
+
return input_text
|
| 45 |
+
|
| 46 |
+
|
| 47 |
def solo_xd(prompt):
|
| 48 |
images = pipe(prompt=prompt).images[0]
|
| 49 |
return images
|
|
|
|
| 89 |
result = client.predict(
|
| 90 |
llama_q, # str in 'Message' Textbox component
|
| 91 |
api_name="/predict"
|
| 92 |
+
)
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
+
result = get_text_after_colon(result)
|
| 95 |
+
|
| 96 |
print(f"Llama2 result: {result}")
|
| 97 |
|
| 98 |
images = pipe(prompt=result).images[0]
|