Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -4,20 +4,15 @@ from pydantic import BaseModel
|
|
4 |
import uvicorn
|
5 |
|
6 |
|
7 |
-
generator = pipeline('text-generation', model='gpt2')
|
8 |
-
set_seed(42)
|
9 |
-
|
10 |
|
11 |
app = FastAPI()
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
class Item(BaseModel):
|
17 |
prompt: str
|
18 |
|
19 |
|
20 |
-
|
|
|
21 |
|
22 |
def generate(item: Item):
|
23 |
generator(item.prompt, max_length=30, num_return_sequences=5)
|
|
|
4 |
import uvicorn
|
5 |
|
6 |
|
|
|
|
|
|
|
7 |
|
8 |
app = FastAPI()
|
9 |
|
|
|
|
|
|
|
10 |
class Item(BaseModel):
|
11 |
prompt: str
|
12 |
|
13 |
|
14 |
+
generator = pipeline('text-generation', model='gpt2')
|
15 |
+
set_seed(42)
|
16 |
|
17 |
def generate(item: Item):
|
18 |
generator(item.prompt, max_length=30, num_return_sequences=5)
|