namberino
commited on
Commit
·
98e6c10
1
Parent(s):
822d3a0
Trying to fix the generator not initialized error
Browse files
app.py
CHANGED
@@ -2,16 +2,12 @@
|
|
2 |
import gradio as gr
|
3 |
from fastapi.testclient import TestClient
|
4 |
import os
|
|
|
5 |
|
6 |
-
|
7 |
-
# Example: from my_fastapi_app import app as fastapi_app
|
8 |
-
from fastapi_app import app as fastapi_app # <-- adjust if filename/variable differs
|
9 |
|
10 |
def call_generate(file_obj, topics: str, n_questions: int, difficulty: str, qtype: str):
|
11 |
-
client = TestClient(fastapi_app) # will trigger startup/lifespan handlers
|
12 |
-
|
13 |
# Prepare file tuple expected by requests-like interface:
|
14 |
-
# ('filefieldname', (filename, fileobj, 'application/pdf'))
|
15 |
if file_obj is None:
|
16 |
return "Please upload a PDF."
|
17 |
|
|
|
2 |
import gradio as gr
|
3 |
from fastapi.testclient import TestClient
|
4 |
import os
|
5 |
+
from fastapi_app import app as fastapi_app
|
6 |
|
7 |
+
client = TestClient(fastapi_app)
|
|
|
|
|
8 |
|
9 |
def call_generate(file_obj, topics: str, n_questions: int, difficulty: str, qtype: str):
|
|
|
|
|
10 |
# Prepare file tuple expected by requests-like interface:
|
|
|
11 |
if file_obj is None:
|
12 |
return "Please upload a PDF."
|
13 |
|