Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
@@ -9,7 +9,7 @@ import soundfile as sf
|
|
9 |
|
10 |
app = FastAPI()
|
11 |
|
12 |
-
#
|
13 |
app.add_middleware(
|
14 |
CORSMiddleware,
|
15 |
allow_origins=["*"],
|
@@ -18,7 +18,7 @@ app.add_middleware(
|
|
18 |
allow_headers=["*"],
|
19 |
)
|
20 |
|
21 |
-
#
|
22 |
translation_models = {
|
23 |
"fr": "Helsinki-NLP/opus-mt-en-fr",
|
24 |
"es": "Helsinki-NLP/opus-mt-en-es",
|
@@ -31,8 +31,8 @@ translation_models = {
|
|
31 |
"ta": "Helsinki-NLP/opus-mt-en-ta"
|
32 |
}
|
33 |
|
34 |
-
#
|
35 |
-
generator = pipeline("text-generation", model="distilgpt2"
|
36 |
whisper_model = WhisperForConditionalGeneration.from_pretrained("openai/whisper-base")
|
37 |
whisper_processor = WhisperProcessor.from_pretrained("openai/whisper-base")
|
38 |
|
|
|
9 |
|
10 |
app = FastAPI()
|
11 |
|
12 |
+
# CORS Configuration
|
13 |
app.add_middleware(
|
14 |
CORSMiddleware,
|
15 |
allow_origins=["*"],
|
|
|
18 |
allow_headers=["*"],
|
19 |
)
|
20 |
|
21 |
+
# Translation Models
|
22 |
translation_models = {
|
23 |
"fr": "Helsinki-NLP/opus-mt-en-fr",
|
24 |
"es": "Helsinki-NLP/opus-mt-en-es",
|
|
|
31 |
"ta": "Helsinki-NLP/opus-mt-en-ta"
|
32 |
}
|
33 |
|
34 |
+
# Initialize Models CORRECTLY
|
35 |
+
generator = pipeline("text-generation", model="distilgpt2") # Fixed: Removed TF args, fixed model name
|
36 |
whisper_model = WhisperForConditionalGeneration.from_pretrained("openai/whisper-base")
|
37 |
whisper_processor = WhisperProcessor.from_pretrained("openai/whisper-base")
|
38 |
|