Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -48,7 +48,16 @@ def launch(input):
|
|
| 48 |
ind = out.index('Response') + len('Response')+2
|
| 49 |
return out[ind:]
|
| 50 |
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
# Set up Gradio Interface
|
| 54 |
# iface = gr.Interface(
|
|
@@ -65,9 +74,22 @@ def launch(input):
|
|
| 65 |
# iface.launch()
|
| 66 |
#title="π Hola-Hello-Bonjour-Mbote-δ½ ε₯½ π <br><br> I am geobot-teacher the student marker! <br><br> I am here to analyse each question to determine whether the response qualifies as a pass or fail. <br><br> Try me :)",
|
| 67 |
#description="Synthetic QA pairs (~1k) was finetuned on top of Gemma_2b_en.")
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
outputs="text",
|
| 72 |
css=css,
|
| 73 |
title="π Hi, I am geobot-teacher: The Student Marker π",
|
|
@@ -75,5 +97,5 @@ iface = gr.Interface(launch,
|
|
| 75 |
"I am here to analyse each question to determine whether the response qualifies as a pass or fail.\n\n"
|
| 76 |
"Try me :)",
|
| 77 |
)
|
| 78 |
-
iface.launch()
|
| 79 |
|
|
|
|
| 48 |
ind = out.index('Response') + len('Response')+2
|
| 49 |
return out[ind:]
|
| 50 |
|
| 51 |
+
# Define the function to handle both text and file input
|
| 52 |
+
def analyze_response(text_input, file_input):
|
| 53 |
+
# Process text and file inputs as required
|
| 54 |
+
# For now, we'll just return a placeholder response
|
| 55 |
+
response = f"Received text: {text_input}\n"
|
| 56 |
+
if file_input is not None:
|
| 57 |
+
response += f"File uploaded: {file_input.name}"
|
| 58 |
+
else:
|
| 59 |
+
response += "No file uploaded."
|
| 60 |
+
return response
|
| 61 |
|
| 62 |
# Set up Gradio Interface
|
| 63 |
# iface = gr.Interface(
|
|
|
|
| 74 |
# iface.launch()
|
| 75 |
#title="π Hola-Hello-Bonjour-Mbote-δ½ ε₯½ π <br><br> I am geobot-teacher the student marker! <br><br> I am here to analyse each question to determine whether the response qualifies as a pass or fail. <br><br> Try me :)",
|
| 76 |
#description="Synthetic QA pairs (~1k) was finetuned on top of Gemma_2b_en.")
|
| 77 |
+
# inputs="text"
|
| 78 |
+
|
| 79 |
+
# iface = gr.Interface(launch,
|
| 80 |
+
# inputs="text",
|
| 81 |
+
# outputs="text",
|
| 82 |
+
# css=css,
|
| 83 |
+
# title="π Hi, I am geobot-teacher: The Student Marker π",
|
| 84 |
+
# description="Hola/Hello/Bonjour/Mbote/δ½ ε₯½ \n\n"
|
| 85 |
+
# "I am here to analyse each question to determine whether the response qualifies as a pass or fail.\n\n"
|
| 86 |
+
# "Try me :)",
|
| 87 |
+
# )
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
iface = gr.Interface(fn=analyze_response,
|
| 91 |
+
inputs=[ gr.Textbox(label="Enter your response"),
|
| 92 |
+
gr.File(label="Upload a file (PDF, JSON, DOCX)")], #"text",
|
| 93 |
outputs="text",
|
| 94 |
css=css,
|
| 95 |
title="π Hi, I am geobot-teacher: The Student Marker π",
|
|
|
|
| 97 |
"I am here to analyse each question to determine whether the response qualifies as a pass or fail.\n\n"
|
| 98 |
"Try me :)",
|
| 99 |
)
|
| 100 |
+
iface.launch(share=True)
|
| 101 |
|