AneelaFatima commited on
Commit
53cbbee
Β·
verified Β·
1 Parent(s): a28070d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -16
app.py CHANGED
@@ -1,18 +1,12 @@
1
  # Gradio Interface
2
- interface = gr.Interface(
3
- fn=generate_test_content,
4
- inputs=[
5
- gr.Textbox(label="πŸ“˜ Subject (e.g., Biology)"),
6
- gr.Textbox(label="πŸ”’ Chapter (e.g., Chapter 2)"),
7
- gr.Textbox(label="πŸ“Œ Topic (e.g., Cell Structure)"),
8
- gr.Radio(["MCQs", "Short Questions", "Long Questions", "Important Topics"], label="❓ Question Type"),
9
- gr.Radio(["English", "Urdu"], label="🌐 Language")
10
- ],
11
- outputs="text",
12
- title="🧠 TestPrep Guru β€” Syllabus-Based Exam Chatbot",
13
- description="Get MCQs, short/long answers, and important topics based on your syllabus. Perfect for Class 9 & 10 students in Pakistan."
14
- )
15
 
16
- # βœ… Fix for Hugging Face Spaces
17
- if __name__ == "__main__":
18
- interface.launch(server_name="0.0.0.0", server_port=7860)
 
 
1
  # Gradio Interface
2
+ import os
3
+ from openai import OpenAI
4
+ import gradio as gr # βœ… This line is required
5
+
6
+ # Load API key from Hugging Face secret
7
+ api_key = os.environ["GROQ_API_KEY"]
 
 
 
 
 
 
 
8
 
9
+ client = OpenAI(
10
+ api_key=api_key,
11
+ base_url="https://api.groq.com/openai/v1"
12
+ )