Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,7 @@ from pydantic import BaseModel
|
|
| 10 |
|
| 11 |
class GenModel(BaseModel):
|
| 12 |
question: str
|
| 13 |
-
system: str = "You are a professional medical assistant."
|
| 14 |
temperature: float = 0.8
|
| 15 |
seed: int = 101
|
| 16 |
|
|
@@ -63,7 +63,7 @@ except Exception as e:
|
|
| 63 |
|
| 64 |
app = fastapi.FastAPI(
|
| 65 |
title="OpenGenAI",
|
| 66 |
-
description="Your Excellect Physician")
|
| 67 |
|
| 68 |
|
| 69 |
@app.get("/")
|
|
@@ -115,8 +115,8 @@ async def chat(gen:GenModel):
|
|
| 115 |
# Chat Completion API
|
| 116 |
@app.post("/generate")
|
| 117 |
async def generate(gen:GenModel):
|
| 118 |
-
gen.system
|
| 119 |
-
gen.temperature
|
| 120 |
gen.seed: int = 42
|
| 121 |
try:
|
| 122 |
st = time()
|
|
@@ -125,8 +125,8 @@ async def generate(gen:GenModel):
|
|
| 125 |
{"role": "system", "content": gen.system},
|
| 126 |
{"role": "user", "content": gen.question},
|
| 127 |
],
|
| 128 |
-
temperature=temperature,
|
| 129 |
-
seed=seed,
|
| 130 |
#stream=True
|
| 131 |
)
|
| 132 |
"""
|
|
|
|
| 10 |
|
| 11 |
class GenModel(BaseModel):
|
| 12 |
question: str
|
| 13 |
+
system: str = "You are a helpful professional medical assistant."
|
| 14 |
temperature: float = 0.8
|
| 15 |
seed: int = 101
|
| 16 |
|
|
|
|
| 63 |
|
| 64 |
app = fastapi.FastAPI(
|
| 65 |
title="OpenGenAI",
|
| 66 |
+
description="Your Excellect AI Physician")
|
| 67 |
|
| 68 |
|
| 69 |
@app.get("/")
|
|
|
|
| 115 |
# Chat Completion API
|
| 116 |
@app.post("/generate")
|
| 117 |
async def generate(gen:GenModel):
|
| 118 |
+
gen.system = "You are an AI assistant."
|
| 119 |
+
gen.temperature = 0.5
|
| 120 |
gen.seed: int = 42
|
| 121 |
try:
|
| 122 |
st = time()
|
|
|
|
| 125 |
{"role": "system", "content": gen.system},
|
| 126 |
{"role": "user", "content": gen.question},
|
| 127 |
],
|
| 128 |
+
temperature = gen.temperature,
|
| 129 |
+
seed= gen.seed,
|
| 130 |
#stream=True
|
| 131 |
)
|
| 132 |
"""
|