Create requirements.txt
Browse files- requirements.txt +19 -1
requirements.txt
CHANGED
|
@@ -1 +1,19 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
# Load QA model
|
| 5 |
+
qa_model = pipeline("question-answering")
|
| 6 |
+
|
| 7 |
+
# TutorPal AI logic
|
| 8 |
+
def tutor_bot(question):
|
| 9 |
+
context = """
|
| 10 |
+
Newton's laws of motion are three physical laws that together laid the foundation for classical mechanics.
|
| 11 |
+
Photosynthesis is the process by which green plants use sunlight to synthesize food from carbon dioxide and water.
|
| 12 |
+
The mitochondrion is the powerhouse of the cell.
|
| 13 |
+
The speed of light is approximately 3.0 × 10^8 m/s.
|
| 14 |
+
"""
|
| 15 |
+
result = qa_model(question=question, context=context)
|
| 16 |
+
return f"Hi, I'm TutorPal 👋\n\nHere's your answer:\n{result['answer']}"
|
| 17 |
+
|
| 18 |
+
# Gradio app
|
| 19 |
+
gr.Interface(fn=tutor_bot, inputs="text", outputs="text", title="📘 TutorPal - Assignment Helper").launch()
|