Spaces:
Runtime error
Runtime error
Manuel Torres commited on
Commit ·
bed1320
1
Parent(s): 4157f4a
Refactor app.py: Remove unused imports and code
Browse files
app.py
CHANGED
|
@@ -3,22 +3,6 @@ from transformers import pipeline
|
|
| 3 |
import gradio as gr
|
| 4 |
import torch
|
| 5 |
import gradio as gr
|
| 6 |
-
from langchain_huggingface import ChatHuggingFace, HuggingFacePipeline
|
| 7 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 8 |
-
from langchain_core.messages import (
|
| 9 |
-
HumanMessage,
|
| 10 |
-
SystemMessage,
|
| 11 |
-
)
|
| 12 |
-
|
| 13 |
-
model_id = "meta-llama/Llama-3.2-1B-Instruct"
|
| 14 |
-
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 15 |
-
model = AutoModelForCausalLM.from_pretrained(model_id)
|
| 16 |
-
pipeLlama = pipeline("text-generation", model=model,
|
| 17 |
-
tokenizer=tokenizer, max_new_tokens=10)
|
| 18 |
-
hf = HuggingFacePipeline(pipeline=pipeLlama)
|
| 19 |
-
|
| 20 |
-
messages = ["""<s><<SYS>>List the key points with details from the next message.<</SYS>>"""]
|
| 21 |
-
|
| 22 |
|
| 23 |
def transcript_audio(audio_file):
|
| 24 |
# Initialize the speech recognition pipeline
|
|
@@ -32,9 +16,6 @@ def transcript_audio(audio_file):
|
|
| 32 |
# Transcribe the audio file and return the result
|
| 33 |
result = pipe(audio_file, batch_size=8)["text"]
|
| 34 |
|
| 35 |
-
# Create a human message from the transcribed text
|
| 36 |
-
messages.append(result)
|
| 37 |
-
|
| 38 |
return result
|
| 39 |
|
| 40 |
|
|
|
|
| 3 |
import gradio as gr
|
| 4 |
import torch
|
| 5 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
def transcript_audio(audio_file):
|
| 8 |
# Initialize the speech recognition pipeline
|
|
|
|
| 16 |
# Transcribe the audio file and return the result
|
| 17 |
result = pipe(audio_file, batch_size=8)["text"]
|
| 18 |
|
|
|
|
|
|
|
|
|
|
| 19 |
return result
|
| 20 |
|
| 21 |
|