Update app.py
Browse files
app.py
CHANGED
@@ -16,9 +16,9 @@ import numpy as np
|
|
16 |
api_key=os.getenv("GOOGLE_API_KEY")
|
17 |
|
18 |
|
19 |
-
|
20 |
os.environ["GOOGLE_API_KEY"] = api_key
|
21 |
-
|
22 |
|
23 |
from crewai_tools import PDFSearchTool
|
24 |
from crewai_tools import FileReadTool
|
@@ -261,12 +261,28 @@ def run_ai(file, query, required_ans_format):
|
|
261 |
result = crew.kickoff()
|
262 |
return result
|
263 |
|
264 |
-
|
265 |
fn=run_ai,
|
266 |
-
inputs=[
|
|
|
|
|
|
|
|
|
267 |
outputs="text",
|
268 |
-
title="
|
269 |
-
description=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
)
|
271 |
|
272 |
-
|
|
|
16 |
api_key=os.getenv("GOOGLE_API_KEY")
|
17 |
|
18 |
|
19 |
+
|
20 |
os.environ["GOOGLE_API_KEY"] = api_key
|
21 |
+
|
22 |
|
23 |
from crewai_tools import PDFSearchTool
|
24 |
from crewai_tools import FileReadTool
|
|
|
261 |
result = crew.kickoff()
|
262 |
return result
|
263 |
|
264 |
+
interface = gr.Interface(
|
265 |
fn=run_ai,
|
266 |
+
inputs=[
|
267 |
+
gr.File(label="Upload File"),
|
268 |
+
gr.Textbox(label="Query"),
|
269 |
+
gr.Textbox(label="Expected Output")
|
270 |
+
],
|
271 |
outputs="text",
|
272 |
+
title="DocuSmart",
|
273 |
+
description=(
|
274 |
+
"Upload a file (CSV, PDF, DOCX, TXT, JSON) and enter your query to get detailed information.\n\n"
|
275 |
+
"### Instructions:\n"
|
276 |
+
"1. Upload the file you want to talk to.\n"
|
277 |
+
"2. Enter your question in the Query field.\n"
|
278 |
+
"3. Specify the desired output format, e.g., one line answer.\n"
|
279 |
+
"4. Press 'Submit' and wait for the response.\n\n"
|
280 |
+
),
|
281 |
+
examples=[
|
282 |
+
["LabManual.pdf", "What is RIP?", "detailed description"],
|
283 |
+
["ElectricCarData_Clean.csv", "Which Brand has most vehicles?", "one line answer"]
|
284 |
+
],
|
285 |
+
theme=gr.themes.Soft()
|
286 |
)
|
287 |
|
288 |
+
interface.launch()
|