paranitik commited on
Commit
6e2b84f
1 Parent(s): 85834c2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -22
app.py CHANGED
@@ -1,24 +1,30 @@
1
  import gradio as gr
2
 
3
- from transformers import pipeline
4
-
5
- pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-ru")
6
-
7
-
8
- def translate(text):
9
- return pipe(text)[0]["translation_text"]
10
-
11
-
12
- with gr.Blocks() as demo:
13
- with gr.Row():
14
- with gr.Column():
15
- english = gr.Textbox(label="English text")
16
- translate_btn = gr.Button(value="Translate")
17
- with gr.Column():
18
- russian = gr.Textbox(label="Russian Text")
19
-
20
- translate_btn.click(translate, inputs=english, outputs=russian, api_name="translate-to-russian")
21
- examples = gr.Examples(examples=["I went to the supermarket yesterday.", "Helen is a good swimmer."],
22
- inputs=[english])
23
-
24
- demo.launch()
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ # Function to handle the logic of PDF viewing, test solving, and homework uploading
4
+ def process_education(topic, test_solution, homework_file):
5
+ # Here you would add the logic to display the PDF associated with the chosen topic,
6
+ # check the test solution, and handle the homework file upload.
7
+ # This is a placeholder for demonstration purposes.
8
+ pdf_view = "PDF for topic: " + topic
9
+ test_result = "Test result based on solution: " + test_solution
10
+ return pdf_view, test_result
11
+
12
+ # Create the Gradio interface
13
+ iface = gr.Interface(
14
+ process_education,
15
+ [
16
+ gr.inputs.Dropdown(['Topic 1', 'Topic 2', 'Topic 3'], label="Choose Topic"),
17
+ gr.inputs.Textbox(lines=2, label="Solve the Test"),
18
+ gr.inputs.File(label="Upload Homework")
19
+ ],
20
+ [
21
+ gr.outputs.HTML(label="View PDF of Chosen Topic"),
22
+ gr.outputs.Textbox(label="Your Test Result")
23
+ ]
24
+ )
25
+
26
+ # Launch the interface; when deploying to Hugging Face Spaces, this line is not needed
27
+ # iface.launch()
28
+
29
+ # Save the interface to be deployed on Hugging Face Spaces
30
+ iface.save_to_huggingface_space("YOUR_HUGGINGFACE_USERNAME/YOUR_SPACE_NAME")