Spaces:
Sleeping
Sleeping
fix to local modal
Browse files
routers/get_chatrespone.py
CHANGED
@@ -32,27 +32,27 @@ async def get_chat_respone(body: ChatInputForm, api_key: str = Depends(get_api_k
|
|
32 |
prompt = get_prompt(body.prompt)
|
33 |
|
34 |
try:
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
|
46 |
messages = [
|
47 |
{"role": "system", "content": prompt},
|
48 |
{"role": "user", "content": body.textInput},
|
49 |
]
|
50 |
|
51 |
-
|
52 |
|
53 |
# response = get_chat_gradio(body.textInput)
|
54 |
|
55 |
-
response = get_chat_transformers(messages)
|
56 |
|
57 |
print(response)
|
58 |
|
|
|
32 |
prompt = get_prompt(body.prompt)
|
33 |
|
34 |
try:
|
35 |
+
llm = OllamaLLM(
|
36 |
+
model=body.repo_id,
|
37 |
+
temperature=0.2,
|
38 |
+
# huggingfacehub_api_token=HUGGINGFACEHUB_API_TOKEN,
|
39 |
+
)
|
40 |
|
41 |
+
messages = [
|
42 |
+
("system", prompt),
|
43 |
+
("human", body.textInput)
|
44 |
+
]
|
45 |
|
46 |
messages = [
|
47 |
{"role": "system", "content": prompt},
|
48 |
{"role": "user", "content": body.textInput},
|
49 |
]
|
50 |
|
51 |
+
response = llm.stream(messages)
|
52 |
|
53 |
# response = get_chat_gradio(body.textInput)
|
54 |
|
55 |
+
# response = get_chat_transformers(messages)
|
56 |
|
57 |
print(response)
|
58 |
|
routers/get_transcript_transformer.py
CHANGED
@@ -30,7 +30,7 @@ def get_transcript(audio_path: str, model_size: str = "distil-whisper/distil-sma
|
|
30 |
convert_to_audio(audio_path.strip(), output_file)
|
31 |
|
32 |
try:
|
33 |
-
text, chunks = get_transcribe_transformers(output_file,
|
34 |
except Exception as error:
|
35 |
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail=f"error>>>: {error}")
|
36 |
finally:
|
|
|
30 |
convert_to_audio(audio_path.strip(), output_file)
|
31 |
|
32 |
try:
|
33 |
+
text, chunks = get_transcribe_transformers(output_file, model_size)
|
34 |
except Exception as error:
|
35 |
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail=f"error>>>: {error}")
|
36 |
finally:
|