Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
from fastapi import FastAPI, HTTPException
|
2 |
from pydantic import BaseModel
|
3 |
-
from huggingface_hub import InferenceClient
|
4 |
|
5 |
app = FastAPI()
|
6 |
|
@@ -51,8 +51,6 @@ def generate(item: Item):
|
|
51 |
output = "".join([response.token.text for response in stream])
|
52 |
return output
|
53 |
|
54 |
-
except BadRequestError as e:
|
55 |
-
raise HTTPException(status_code=400, detail=f"Bad request: {str(e)}")
|
56 |
except Exception as e:
|
57 |
raise HTTPException(status_code=500, detail=f"Internal error: {str(e)}")
|
58 |
|
|
|
1 |
from fastapi import FastAPI, HTTPException
|
2 |
from pydantic import BaseModel
|
3 |
+
from huggingface_hub import InferenceClient
|
4 |
|
5 |
app = FastAPI()
|
6 |
|
|
|
51 |
output = "".join([response.token.text for response in stream])
|
52 |
return output
|
53 |
|
|
|
|
|
54 |
except Exception as e:
|
55 |
raise HTTPException(status_code=500, detail=f"Internal error: {str(e)}")
|
56 |
|