Spaces:
Starting on Zero
Starting on Zero
Commit ·
3cbdf32
1
Parent(s): 1b34aa5
globalized formetted history
Browse files
app.py
CHANGED
|
@@ -15,7 +15,7 @@ system_prompt = """"<s>[INST] You are Friday, a helpful and conversational AI as
|
|
| 15 |
|
| 16 |
chat_history = system_prompt + """"""
|
| 17 |
|
| 18 |
-
|
| 19 |
|
| 20 |
client = InferenceClient(LLM_MODEL_NAME)
|
| 21 |
|
|
@@ -43,7 +43,7 @@ def generate(user_prompt, temperature=0.1, max_new_tokens=128, top_p=0.95, repet
|
|
| 43 |
seed=42,
|
| 44 |
)
|
| 45 |
|
| 46 |
-
chat_history += f"""
|
| 47 |
|
| 48 |
output = client.text_generation(
|
| 49 |
chat_history, **generate_kwargs, stream=False, details=False, return_full_text=False)
|
|
@@ -73,6 +73,8 @@ def transcribe(audio):
|
|
| 73 |
|
| 74 |
print(formatted_history)
|
| 75 |
|
|
|
|
|
|
|
| 76 |
return "response.mp3"
|
| 77 |
|
| 78 |
|
|
@@ -89,6 +91,8 @@ with gr.Blocks() as demo:
|
|
| 89 |
transcribe_btn = gr.Button("Transcribe")
|
| 90 |
transcribe_btn.click(fn=transcribe, inputs=audio_input,
|
| 91 |
outputs=output_audio)
|
|
|
|
|
|
|
| 92 |
|
| 93 |
|
| 94 |
demo.queue()
|
|
|
|
| 15 |
|
| 16 |
chat_history = system_prompt + """"""
|
| 17 |
|
| 18 |
+
global formatted_history
|
| 19 |
|
| 20 |
client = InferenceClient(LLM_MODEL_NAME)
|
| 21 |
|
|
|
|
| 43 |
seed=42,
|
| 44 |
)
|
| 45 |
|
| 46 |
+
chat_history += f"""<s>[INST] {user_prompt} [/INST] """
|
| 47 |
|
| 48 |
output = client.text_generation(
|
| 49 |
chat_history, **generate_kwargs, stream=False, details=False, return_full_text=False)
|
|
|
|
| 73 |
|
| 74 |
print(formatted_history)
|
| 75 |
|
| 76 |
+
print(chat_history)
|
| 77 |
+
|
| 78 |
return "response.mp3"
|
| 79 |
|
| 80 |
|
|
|
|
| 91 |
transcribe_btn = gr.Button("Transcribe")
|
| 92 |
transcribe_btn.click(fn=transcribe, inputs=audio_input,
|
| 93 |
outputs=output_audio)
|
| 94 |
+
|
| 95 |
+
transcription_box = gr.Textbox(formatted_history, label="Transcription", interactive=True)
|
| 96 |
|
| 97 |
|
| 98 |
demo.queue()
|