Spaces:
Runtime error
Runtime error
add imports
Browse files- app/api.py +8 -1
app/api.py
CHANGED
@@ -1,7 +1,12 @@
|
|
1 |
from fastapi import FastAPI, WebSocket
|
2 |
from fastapi.responses import HTMLResponse
|
|
|
|
|
|
|
3 |
import os
|
4 |
-
|
|
|
|
|
5 |
|
6 |
app = FastAPI()
|
7 |
|
@@ -45,6 +50,7 @@ html = """
|
|
45 |
async def get():
|
46 |
return HTMLResponse(html)
|
47 |
|
|
|
48 |
@app.get("/env")
|
49 |
async def env():
|
50 |
environment_variables = "<h3>Environment Variables</h3>"
|
@@ -52,6 +58,7 @@ async def env():
|
|
52 |
environment_variables += f"{name}: {value}<br>"
|
53 |
return HTMLResponse(environment_variables)
|
54 |
|
|
|
55 |
@app.websocket("/ws")
|
56 |
async def websocket_endpoint(websocket: WebSocket):
|
57 |
await websocket.accept()
|
|
|
1 |
from fastapi import FastAPI, WebSocket
|
2 |
from fastapi.responses import HTMLResponse
|
3 |
+
from fastapi import Form, Depends, HTTPException, status
|
4 |
+
from transformers import pipeline, set_seed, AutoConfig, AutoTokenizer, GPT2LMHeadModel
|
5 |
+
import torch
|
6 |
import os
|
7 |
+
import time
|
8 |
+
import re
|
9 |
+
import json
|
10 |
|
11 |
app = FastAPI()
|
12 |
|
|
|
50 |
async def get():
|
51 |
return HTMLResponse(html)
|
52 |
|
53 |
+
|
54 |
@app.get("/env")
|
55 |
async def env():
|
56 |
environment_variables = "<h3>Environment Variables</h3>"
|
|
|
58 |
environment_variables += f"{name}: {value}<br>"
|
59 |
return HTMLResponse(environment_variables)
|
60 |
|
61 |
+
|
62 |
@app.websocket("/ws")
|
63 |
async def websocket_endpoint(websocket: WebSocket):
|
64 |
await websocket.accept()
|