Spaces:
Runtime error
Runtime error
VsCode
commited on
Commit
Β·
65f4d38
1
Parent(s):
e4c5bba
solving conflit in login function again 4
Browse files
app.py
CHANGED
|
@@ -31,21 +31,20 @@ app.add_middleware(
|
|
| 31 |
print("Carregando modelo MedGemma...")
|
| 32 |
pipe = None
|
| 33 |
|
|
|
|
|
|
|
| 34 |
@app.on_event("startup")
|
| 35 |
async def startup_event():
|
| 36 |
global pipe
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
SPACE_URL = "https://Edalexan-Carelink_Med_module.hf.space"
|
| 48 |
-
|
| 49 |
logging.basicConfig(level=logging.INFO)
|
| 50 |
logging.info("===================================")
|
| 51 |
logging.info("π Application ready")
|
|
|
|
| 31 |
print("Carregando modelo MedGemma...")
|
| 32 |
pipe = None
|
| 33 |
|
| 34 |
+
import os
|
| 35 |
+
from transformers import pipeline
|
| 36 |
@app.on_event("startup")
|
| 37 |
async def startup_event():
|
| 38 |
global pipe
|
| 39 |
+
token = os.environ.get("HF_TOKEN")
|
| 40 |
+
if not token:
|
| 41 |
+
raise RuntimeError("HF_TOKEN nΓ£o encontrado no ambiente")
|
| 42 |
+
pipe = pipeline(
|
| 43 |
+
"image-text-to-text",
|
| 44 |
+
model="google/medgemma-4b-it",
|
| 45 |
+
token=token # π ESTE Γ© o ponto crΓtico
|
| 46 |
+
)
|
| 47 |
+
print("Modelo MedGemma carregado com sucesso!")
|
|
|
|
|
|
|
|
|
|
| 48 |
logging.basicConfig(level=logging.INFO)
|
| 49 |
logging.info("===================================")
|
| 50 |
logging.info("π Application ready")
|