Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -52,12 +52,14 @@ def analyze_image(image, instruction):
|
|
| 52 |
top_p=0.1,
|
| 53 |
)
|
| 54 |
|
| 55 |
-
# Extract
|
| 56 |
-
analysis =
|
| 57 |
-
return analysis
|
|
|
|
|
|
|
| 58 |
except Exception as e:
|
| 59 |
-
return f"Error:
|
| 60 |
-
|
| 61 |
# Gradio interface
|
| 62 |
iface = gr.Interface(
|
| 63 |
fn=analyze_image,
|
|
|
|
| 52 |
top_p=0.1,
|
| 53 |
)
|
| 54 |
|
| 55 |
+
# Extract the content from the first choice
|
| 56 |
+
analysis = response["choices"][0]["message"]["content"]
|
| 57 |
+
return analysis.strip()
|
| 58 |
+
except KeyError:
|
| 59 |
+
return "Error: Response format from the API is unexpected."
|
| 60 |
except Exception as e:
|
| 61 |
+
return f"Error:
|
| 62 |
+
|
| 63 |
# Gradio interface
|
| 64 |
iface = gr.Interface(
|
| 65 |
fn=analyze_image,
|