Dannyar608 commited on
Commit
4c7cd60
·
verified ·
1 Parent(s): 0bf88e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -10
app.py CHANGED
@@ -223,7 +223,6 @@ def parse_transcript_with_deepseek(text: str) -> Dict:
223
  * Credits earned
224
  * Year/semester taken
225
  * Grade level when taken
226
-
227
  Return the data in this JSON structure:
228
  {{
229
  "grade_level": "11",
@@ -242,19 +241,13 @@ def parse_transcript_with_deepseek(text: str) -> Dict:
242
  }}
243
  ]
244
  }}
245
-
246
  Transcript Text:
247
  {text}
248
  """
249
 
250
  try:
251
- # Show progress to user
252
- progress = gr.Progress()
253
- progress(0, desc="Analyzing transcript...")
254
-
255
  # Tokenize and generate response
256
  inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
257
- progress(0.3)
258
 
259
  outputs = model.generate(
260
  **inputs,
@@ -262,11 +255,9 @@ def parse_transcript_with_deepseek(text: str) -> Dict:
262
  temperature=0.1,
263
  do_sample=True
264
  )
265
- progress(0.8)
266
 
267
  # Decode the response
268
  response = tokenizer.decode(outputs[0], skip_special_tokens=True)
269
- progress(0.9)
270
 
271
  # Extract the JSON content from the response
272
  if '```json' in response:
@@ -278,7 +269,6 @@ def parse_transcript_with_deepseek(text: str) -> Dict:
278
 
279
  # Parse and validate the JSON
280
  parsed_data = json.loads(json_str)
281
- progress(1.0)
282
 
283
  return validate_parsed_data(parsed_data)
284
 
 
223
  * Credits earned
224
  * Year/semester taken
225
  * Grade level when taken
 
226
  Return the data in this JSON structure:
227
  {{
228
  "grade_level": "11",
 
241
  }}
242
  ]
243
  }}
 
244
  Transcript Text:
245
  {text}
246
  """
247
 
248
  try:
 
 
 
 
249
  # Tokenize and generate response
250
  inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
 
251
 
252
  outputs = model.generate(
253
  **inputs,
 
255
  temperature=0.1,
256
  do_sample=True
257
  )
 
258
 
259
  # Decode the response
260
  response = tokenizer.decode(outputs[0], skip_special_tokens=True)
 
261
 
262
  # Extract the JSON content from the response
263
  if '```json' in response:
 
269
 
270
  # Parse and validate the JSON
271
  parsed_data = json.loads(json_str)
 
272
 
273
  return validate_parsed_data(parsed_data)
274