Update app.py
Browse files
app.py
CHANGED
|
@@ -1,18 +1,17 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
-
from PIL import Image
|
| 4 |
|
| 5 |
-
def
|
| 6 |
-
# Dummy function to simulate
|
| 7 |
-
# Replace with your actual
|
| 8 |
-
|
| 9 |
-
{"
|
| 10 |
-
{"
|
| 11 |
-
{"
|
| 12 |
]
|
| 13 |
|
| 14 |
-
# Convert
|
| 15 |
-
df = pd.DataFrame(
|
| 16 |
|
| 17 |
# Convert DataFrame to HTML table with clickable links
|
| 18 |
table_html = df.to_html(escape=False, index=False, render_links=True)
|
|
@@ -21,11 +20,12 @@ def process_image(image):
|
|
| 21 |
|
| 22 |
# Create a Gradio interface
|
| 23 |
iface = gr.Interface(
|
| 24 |
-
fn=
|
| 25 |
-
inputs=gr.inputs.
|
| 26 |
outputs="html",
|
| 27 |
-
title="
|
| 28 |
-
description="
|
| 29 |
)
|
| 30 |
|
| 31 |
iface.launch()
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
|
|
|
| 3 |
|
| 4 |
+
def generate_solutions(query):
|
| 5 |
+
# Dummy function to simulate solution generation
|
| 6 |
+
# Replace with your actual logic for generating solutions
|
| 7 |
+
solutions = [
|
| 8 |
+
{"Solution": "Check the power supply", "Link": "https://example.com/power-supply"},
|
| 9 |
+
{"Solution": "Inspect the wiring", "Link": "https://example.com/wiring-inspection"},
|
| 10 |
+
{"Solution": "Update the firmware", "Link": "https://example.com/firmware-update"}
|
| 11 |
]
|
| 12 |
|
| 13 |
+
# Convert solutions to a DataFrame
|
| 14 |
+
df = pd.DataFrame(solutions)
|
| 15 |
|
| 16 |
# Convert DataFrame to HTML table with clickable links
|
| 17 |
table_html = df.to_html(escape=False, index=False, render_links=True)
|
|
|
|
| 20 |
|
| 21 |
# Create a Gradio interface
|
| 22 |
iface = gr.Interface(
|
| 23 |
+
fn=generate_solutions,
|
| 24 |
+
inputs=gr.inputs.Textbox(lines=2, placeholder="Describe the problem with the machine..."),
|
| 25 |
outputs="html",
|
| 26 |
+
title="Industry Maintenance Assistant",
|
| 27 |
+
description="Describe the problem with your machine, and get an organized table of suggested solutions with web links."
|
| 28 |
)
|
| 29 |
|
| 30 |
iface.launch()
|
| 31 |
+
|