ShebMichel commited on
Commit
a119f09
Β·
verified Β·
1 Parent(s): c8a63d0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -5
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
- iface = gr.Interface(launch,
69
- gr.File(label="Upload a file (PDF, JSON, DOCX)")
70
- inputs="text",
 
 
 
 
 
 
 
 
 
 
 
 
 
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