Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -169,6 +169,20 @@ def save_image(image_input, output_dir="saved_images"):
|
|
| 169 |
else:
|
| 170 |
raise ValueError("Invalid image input type")
|
| 171 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
|
| 173 |
def process_speech(input_language, audio_input):
|
| 174 |
"""
|
|
|
|
| 169 |
else:
|
| 170 |
raise ValueError("Invalid image input type")
|
| 171 |
|
| 172 |
+
def process_image(image_file_path):
|
| 173 |
+
"""
|
| 174 |
+
Process the image using the Gradio client.
|
| 175 |
+
"""
|
| 176 |
+
try:
|
| 177 |
+
# Use the Gradio client to predict
|
| 178 |
+
result = client.predict(
|
| 179 |
+
image_file_path, # File path of the image
|
| 180 |
+
True, # Enable detailed captioning
|
| 181 |
+
fn_index=2 # Function index for the Gradio model
|
| 182 |
+
)
|
| 183 |
+
return result
|
| 184 |
+
except Exception as e:
|
| 185 |
+
return f"Error occurred during image processing: {e}"
|
| 186 |
|
| 187 |
def process_speech(input_language, audio_input):
|
| 188 |
"""
|