Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,18 +1,12 @@
|
|
| 1 |
# Gradio Interface
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 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 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
| 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 |
+
)
|