Commit ·
a03ba43
1
Parent(s): b0cfb8c
fix: streamline image handling and clean up unused code
Browse files- gradio_app.py +5 -6
gradio_app.py
CHANGED
|
@@ -42,16 +42,15 @@ async def run_agent(request, history):
|
|
| 42 |
if generated_files:
|
| 43 |
image_path = os.path.join(PANDAS_EXPORTS_PATH, generated_files[0])
|
| 44 |
image_markdown = image_to_base64_markdown(image_path)
|
| 45 |
-
|
| 46 |
# Remove the image file after reading it
|
| 47 |
os.remove(image_path)
|
| 48 |
else:
|
| 49 |
-
image_path = f"{PANDAS_EXPORTS_PATH}/blank_chart.png"
|
| 50 |
-
image_markdown = image_to_base64_markdown(image_path)
|
|
|
|
| 51 |
|
| 52 |
print(f"Image path: {image_path}")
|
| 53 |
-
|
| 54 |
-
output = image_markdown + response
|
| 55 |
|
| 56 |
# print(output)
|
| 57 |
|
|
@@ -61,7 +60,7 @@ async def run_agent(request, history):
|
|
| 61 |
# ====================================== Gradio UI with history
|
| 62 |
LOGO_PATH = "resources/logo.png"
|
| 63 |
with gr.Blocks() as demo:
|
| 64 |
-
gr.Image(value=LOGO_PATH, height=100, width=100, elem_id="logo")
|
| 65 |
with gr.Row():
|
| 66 |
with gr.Column():
|
| 67 |
gr.Markdown("<center><h1>Talk to Your Data</h1></center>")
|
|
|
|
| 42 |
if generated_files:
|
| 43 |
image_path = os.path.join(PANDAS_EXPORTS_PATH, generated_files[0])
|
| 44 |
image_markdown = image_to_base64_markdown(image_path)
|
| 45 |
+
output = image_markdown + response
|
| 46 |
# Remove the image file after reading it
|
| 47 |
os.remove(image_path)
|
| 48 |
else:
|
| 49 |
+
# image_path = f"{PANDAS_EXPORTS_PATH}/blank_chart.png"
|
| 50 |
+
# image_markdown = image_to_base64_markdown(image_path)
|
| 51 |
+
output = response
|
| 52 |
|
| 53 |
print(f"Image path: {image_path}")
|
|
|
|
|
|
|
| 54 |
|
| 55 |
# print(output)
|
| 56 |
|
|
|
|
| 60 |
# ====================================== Gradio UI with history
|
| 61 |
LOGO_PATH = "resources/logo.png"
|
| 62 |
with gr.Blocks() as demo:
|
| 63 |
+
# gr.Image(value=LOGO_PATH, height=100, width=100, elem_id="logo")
|
| 64 |
with gr.Row():
|
| 65 |
with gr.Column():
|
| 66 |
gr.Markdown("<center><h1>Talk to Your Data</h1></center>")
|