ehsannotes commited on
Commit
1eb9619
·
verified ·
1 Parent(s): 4d5b2cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -4
app.py CHANGED
@@ -1,5 +1,29 @@
1
- # app.py (top section)
2
- from supabase import create_client
3
- from config import SUPABASE_URL, SUPABASE_KEY
4
 
5
- supabase = create_client(SUPABASE_URL, SUPABASE_KEY)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import spacy
3
+ from transformers import pipeline
4
 
5
+ # Load models
6
+ nlp = spacy.load("en_core_web_lg")
7
+ vocab_model = pipeline("text-classification", model="roberta-base")
8
+
9
+ def analyze_essay(essay):
10
+ # Vocabulary analysis
11
+ vocab_score = vocab_model(essay)[0]['score'] * 9
12
+
13
+ # Grammar check (simple version)
14
+ grammar_score = 9 - min(8, essay.count(' ') // 50) # Mock grammar score
15
+
16
+ return {
17
+ "Vocabulary Band": round(vocab_score, 1),
18
+ "Grammar Band": grammar_score,
19
+ "Overall Band": round((vocab_score + grammar_score) / 2, 1)
20
+ }
21
+
22
+ with gr.Blocks() as demo:
23
+ gr.Markdown("## IELTS Writing Evaluator")
24
+ essay_input = gr.Textbox(label="Paste Your Essay", lines=10)
25
+ output = gr.JSON()
26
+ submit = gr.Button("Evaluate")
27
+ submit.click(analyze_essay, inputs=essay_input, outputs=output)
28
+
29
+ demo.launch()