Spaces:
Runtime error
Runtime error
BjarneBepaData
commited on
Commit
•
dd7cd5f
1
Parent(s):
c28d5f3
Start building the CUDA container image
Browse files- app/main.py +2 -22
app/main.py
CHANGED
@@ -1,27 +1,7 @@
|
|
1 |
-
from typing import Union
|
2 |
-
from mistralai.client import MistralClient
|
3 |
-
from mistralai.models.chat_completion import ChatMessage
|
4 |
from fastapi import FastAPI
|
5 |
-
import streamlit as st
|
6 |
-
import os
|
7 |
|
8 |
app = FastAPI()
|
9 |
|
10 |
-
api_key = "RjxyIWwyffo7JdSmqQFuIFVl8zUjoLzi"
|
11 |
-
model = "mistral-large-latest"
|
12 |
-
|
13 |
-
client = MistralClient(api_key=api_key)
|
14 |
-
|
15 |
-
|
16 |
@app.get("/")
|
17 |
-
def
|
18 |
-
|
19 |
-
model=model,
|
20 |
-
messages=[ChatMessage(role="user", content="What is the best French cheese?")]
|
21 |
-
):
|
22 |
-
print(response.choices[0].delta.content or "")
|
23 |
-
# chat_response = client.chat(
|
24 |
-
# model=model,
|
25 |
-
# messages=[ChatMessage(role="user", content="What is the best French cheese?")]
|
26 |
-
# )
|
27 |
-
return {"Hello": chat_response.choices[0].message.content}
|
|
|
|
|
|
|
|
|
1 |
from fastapi import FastAPI
|
|
|
|
|
2 |
|
3 |
app = FastAPI()
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
@app.get("/")
|
6 |
+
def root():
|
7 |
+
return {"Hello": "World"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|