Spaces:
Runtime error
Runtime error
Commit History
-
Create Merge this Auth0 login into your existing TOEFL Gradio app.
Verified signatureimport os import gradio as gr import openai import whisper from gtts import gTTS from fpdf import FPDF import pandas as pd import time from flask import Flask, request, session, redirect, url_for from authlib.integrations.flask_client import OAuth from dotenv import load_dotenv, find_dotenv from threading import Thread Load environment variables ENV_FILE = find_dotenv() if ENV_FILE: load_dotenv(ENV_FILE) === Flask App for Auth0 === flask_app = Flask(name) flask_app.secret_key = os.getenv("APP_SECRET_KEY") oauth = OAuth(flask_app) oauth.register( "auth0", client_id=os.getenv("AUTH0_CLIENT_ID"), client_secret=os.getenv("AUTH0_CLIENT_SECRET"), client_kwargs={"scope": "openid profile email"}, server_metadata_url=f'https://{os.getenv("AUTH0_DOMAIN")}/.well-known/openid-configuration' ) @flask_app.route("/login") def login(): return oauth.auth0.authorize_redirect(redirect_uri=url_for("callback", _external=True)) @flask_app.route("/callback") def callback(): token = oauth.auth0.authori…a721b3b -
Update app.py
Verified signatureimport os import gradio as gr import openai import whisper from gtts import gTTS from fpdf import FPDF import pandas as pd import time # 🔐 Set your OpenAI API key securely from environment variables openai.api_key = os.environ.get("OPENAI_API_KEY") # 🎙️ Load Whisper ASR model model = whisper.load_model("base") # 📁 CSV log file LOG_FILE = "toefl_logs.csv" if not os.path.exists(LOG_FILE): pd.DataFrame(columns=["timestamp", "prompt", "transcript", "feedback"]).to_csv(LOG_FILE, index=False) # 📝 TOEFL speaking prompts prompts = [ "Do you agree or disagree with the idea that people learn more from failure than from success?", "Some people believe that couples should live together before marriage. Do you agree or disagree?", "Describe a teacher who has greatly influenced your life. What qualities did they have?" ] # 🌐 Translations for multilingual UI labels translations = { "English": { "audio_label": "Audio Feedback", "pdf_label": "Download PDF",…1e44e76 -
Update Requirements.txt
Verified signaturegit+https://github.com/openai/whisper.git openai gtts fpdf pandas gradio==5.36.248e5b8d -
Update requirements.txt
Verified signaturegit+https://github.com/openai/whisper.git openai gtts fpdf pandas gradio==5.36.27b1d577 -
Update app.py
Verified signatureimport os import gradio as gr import openai import whisper from gtts import gTTS from fpdf import FPDF import pandas as pd import time # 🔐 Set your OpenAI API key securely from environment variables openai.api_key = os.environ.get("OPENAI_API_KEY") # 🎙️ Load Whisper ASR model model = whisper.load_model("base") # 📁 CSV log file LOG_FILE = "toefl_logs.csv" if not os.path.exists(LOG_FILE): pd.DataFrame(columns=["timestamp", "prompt", "transcript", "feedback"]).to_csv(LOG_FILE, index=False) # 📝 TOEFL speaking prompts prompts = [ "Do you agree or disagree with the idea that people learn more from failure than from success?", "Some people believe that couples should live together before marriage. Do you agree or disagree?", "Describe a teacher who has greatly influenced your life. What qualities did they have?" ] # 🌐 Translations for multilingual UI labels translations = { "English": { "audio_label": "Audio Feedback", "pdf_label": "Download PDF",…37e4ae4 -
Update requirements.txt
Verified signatured671697 -
Update Requirements.txt
Verified signaturegit+https://github.com/openai/whisper.git openai gtts fpdf pandas gradio7288161 -
Update app.py
Verified signaturef61c985 -
Update app.py
Verified signatureimport os import gradio as gr import openai import whisper from gtts import gTTS from fpdf import FPDF import pandas as pd import time # 🔐 Set your OpenAI API key securely from environment variables openai.api_key = os.environ.get("OPENAI_API_KEY") # 🎙️ Load Whisper ASR model model = whisper.load_model("base") # 📁 CSV log file LOG_FILE = "toefl_logs.csv" if not os.path.exists(LOG_FILE): pd.DataFrame(columns=["timestamp", "prompt", "transcript", "feedback"]).to_csv(LOG_FILE, index=False) # 📝 TOEFL speaking prompts prompts = [ "Do you agree or disagree with the idea that people learn more from failure than from success?", "Some people believe that couples should live together before marriage. Do you agree or disagree?", "Describe a teacher who has greatly influenced your life. What qualities did they have?" ] # 🌐 Translations for multilingual UI labels translations = { "English": { "audio_label": "Audio Feedback", "pdf_label": "Download PDF",…102eb46 -
Update app.py
Verified signatureimport os import gradio as gr import openai import whisper from gtts import gTTS from fpdf import FPDF import pandas as pd import time # 🔐 Set your OpenAI key securely via Hugging Face Secrets openai.api_key = os.environ.get("OPENAI_API_KEY") # 🎙️ Load Whisper model model = whisper.load_model("base") # 📝 Sample TOEFL prompts prompts = [ "Do you agree or disagree with the idea that people learn more from failure than from success?", "Some people believe that couples should live together before marriage. Do you agree or disagree?", "Describe a teacher who has greatly influenced your life. What qualities did they have?" ] # 📁 CSV logging setup LOG_FILE = "toefl_logs.csv" if not os.path.exists(LOG_FILE): pd.DataFrame(columns=["timestamp", "prompt", "transcript", "feedback"]).to_csv(LOG_FILE, index=False) # 🎯 Transcribe audio def transcribe(audio): result = model.transcribe(audio) return result["text"] # 🤖 Score and provide feedback using GPT def get_feed…b2315f8 -
Update app.py
Verified signatureimport gradio as gr def greet(name): return "Hello " + name + "!" demo = gr.Interface(fn=greet, inputs="text", outputs="text") demo.launch()dc24fb8 -
Update README.md
Verified signature--- title: Toefl Speaking Practice emoji: 📚 colorFrom: purple colorTo: blue sdk: gradio sdk_version: 5.36.2 app_file: app.py pinned: true license: mit short_description: An AI-powered TOEFL Speaking Practice Tool with Whisper, GPT thumbnail: https://cdn-uploads.huggingface.co/production/uploads/68722c688176b9e18629fdae/vty4f1bnte4a0RNQxeolG.png ---7d2234f -
App.py
Verified signatureimport gradio as gr import whisper import openai from gtts import gTTS from fpdf import FPDF import pandas as pd import os from datetime import datetime # Load Whisper model once model = whisper.load_model("base") # Sample TOEFL prompts in English and Pashto prompts_en = [ "Some people believe that couples should live together before marriage. Do you agree or disagree? Support your opinion.", "Describe a memorable event from your childhood.", "What is your favorite book and why?" ] prompts_ps = [ "ځینې خلک باور لري چې میړه او ښځه باید مخکې له واده سره ګډ ژوند وکړي. ایا تاسو موافق یاست؟ خپل نظر ورکړئ.", "د خپلې کوچنیتوب یوه یادګاري پېښه بیان کړئ.", "ستاسو خوښ کتاب کوم دی او ولې؟" ] # Store responses for CSV export responses = [] def toefl_speaking(audio, prompt, language): # Transcribe audio using Whisper if audio is None: return "Please record your answer first.", "", None result = model.transcribe(audio) transcript = result["text"] …0ee4b8f -
requirements.txt
Verified signaturegit+https://github.com/openai/whisper.git openai gtts fpdf pandas gradio==5.36.2075d65d -
Create Requirements.txt
Verified signaturegit+https://github.com/openai/whisper.git openai gtts fpdf pandas gradio==5.36.2e4a7898 -
Update app.py
Verified signatureimport gradio as gr import whisper import openai from gtts import gTTS from fpdf import FPDF import pandas as pd import os from datetime import datetime # Load Whisper model once model = whisper.load_model("base") # Sample TOEFL prompts in English and Pashto prompts_en = [ "Some people believe that couples should live together before marriage. Do you agree or disagree? Support your opinion.", "Describe a memorable event from your childhood.", "What is your favorite book and why?" ] prompts_ps = [ "ځینې خلک باور لري چې میړه او ښځه باید مخکې له واده سره ګډ ژوند وکړي. ایا تاسو موافق یاست؟ خپل نظر ورکړئ.", "د خپلې کوچنیتوب یوه یادګاري پېښه بیان کړئ.", "ستاسو خوښ کتاب کوم دی او ولې؟" ] # Store responses for CSV export responses = [] def toefl_speaking(audio, prompt, language): # Transcribe audio using Whisper if audio is None: return "Please record your answer first.", "", None result = model.transcribe(audio) transcript = result["text"] …0472f50 -
Update README.md
Verified signature# TOEFL Speaking Practice 🏃 An AI-powered TOEFL Speaking Practice Tool supporting English and Pashto languages. ## Features - Record your spoken answers using microphone input - Automatic transcription using OpenAI Whisper - GPT-based scoring and detailed feedback - Text-to-speech playback of feedback in English or Pashto - Export all answers and feedback as PDF or CSV - Bilingual interface (English / Pashto) - Mobile-friendly UI ## Setup 1. Clone the repository or create a new Hugging Face Space. 2. Add your OpenAI API key as an environment variable: `OPENAI_API_KEY`. 3. Ensure `requirements.txt` is installed. 4. Run `app.py`. ## Dependencies - [Whisper](https://github.com/openai/whisper) - [OpenAI API](https://platform.openai.com/) - [gTTS](https://pypi.org/project/gTTS/) - [FPDF](https://pypi.org/project/fpdf/) - [Pandas](https://pandas.pydata.org/) - [Gradio](https://gradio.app/) ## Usage Simply select a prompt and language, record your answer, submit, and get instant transcr…af07fec -
Create requirements.txt
Verified signature5e65c9d -
Create app.py
Verified signatureimport gradio as gr import whisper import os import openai from gtts import gTTS from datetime import datetime from fpdf import FPDF import pandas as pd # Load Whisper model model = whisper.load_model("base") # Get OpenAI API key from secret openai.api_key = os.getenv("OPENAI_API_KEY") # CSV file to store session logs csv_path = "toefl_sessions.csv" if not os.path.exists(csv_path): df_init = pd.DataFrame(columns=["timestamp", "prompt", "transcript", "score", "feedback"]) df_init.to_csv(csv_path, index=False) # TOEFL prompts prompts = [ "Some people believe that couples should live together before marriage. Do you agree or disagree?", "Do you prefer to study alone or in a group? Why?", "Should students be required to wear school uniforms? Support your answer.", "Is it better to live in a big city or a small town? Give reasons.", "Do you think people learn more from failure or success? Explain." ] # Transcribe function def transcribe_audio(audio): res…e82df15 -
Update README.md
Verified signature--- title: TOEFL Speaking Practice emoji: 🎤 colorFrom: teal colorTo: indigo sdk: gradio sdk_version: 5.36.2 app_file: app.py pinned: true license: mit short_description: Practice TOEFL Speaking with real prompts, Whisper transcription, GPT scoring, TTS feedback, and PDF/CSV export. --- # 🎓 TOEFL Speaking Practice Tool This AI-powered tool helps students practice the **TOEFL iBT Independent Speaking section**. It offers: ✅ Real TOEFL-style prompts ✅ Audio recording and transcription using Whisper ✅ GPT scoring and feedback ✅ Text-to-Speech (TTS) playback of feedback ✅ PDF download of transcript and feedback ✅ CSV export for tracking your progress --- ## 🚀 How to Use 1. 🎙️ **Record Your Answer** Click the microphone, speak your answer (max 45 seconds), and stop recording. 2. 📄 **Transcription & Scoring** Whisper will transcribe your response. GPT will provide a score and detailed feedback. 3. 🔈 **TTS Playback** Listen to GPT feedback using built…dae4ad9 -
Update README.md
Verified signature--- title: TOEFL Speaking Practice emoji: 🎤 colorFrom: teal colorTo: indigo sdk: gradio sdk_version: 5.36.2 app_file: app.py pinned: true license: mit short_description: Practice TOEFL Speaking with real prompts, Whisper transcription, GPT scoring, TTS feedback, and PDF/CSV export. ---52fd6c8 -
initial commit
Verified signaturef766db0