sagar007 commited on
Commit
62de072
1 Parent(s): 24a5380

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -19
app.py CHANGED
@@ -1,28 +1,30 @@
1
  import gradio as gr
2
  import torch
3
- from moshi import load_model, transcribe
4
 
5
- # Load the model
6
- model = load_model("kyutai/moshika-pytorch-bf16")
 
7
 
8
- def process_audio(audio):
9
- # Convert audio to tensor
10
- audio_tensor = torch.tensor(audio).float()
11
- if audio_tensor.dim() == 2:
12
- audio_tensor = audio_tensor.mean(dim=1)
13
-
14
- # Transcribe audio
15
- transcription = transcribe(model, audio_tensor)
16
- return transcription
 
 
 
17
 
18
- # Create Gradio interface
19
  iface = gr.Interface(
20
- fn=process_audio,
21
- inputs=gr.Audio(source="upload", type="numpy"),
22
- outputs=gr.Textbox(label="Transcription"),
23
- title="Moshi Speech-to-Text",
24
- description="Upload an audio file to transcribe using the Moshi model."
25
  )
26
 
27
- # Launch the app
28
  iface.launch()
 
1
  import gradio as gr
2
  import torch
3
+ import moshi
4
 
5
+ # Print out the contents of the moshi module
6
+ print("Contents of moshi module:")
7
+ print(dir(moshi))
8
 
9
+ # Try to access some common attributes or functions
10
+ print("\nTrying to access common attributes or functions:")
11
+ for item in ['load_model', 'transcribe', 'MoshiServer', 'Moshi', 'MoshiConfig']:
12
+ try:
13
+ attr = getattr(moshi, item)
14
+ print(f"{item}: {attr}")
15
+ except AttributeError:
16
+ print(f"{item} not found in moshi module")
17
+
18
+ # Create a simple Gradio interface
19
+ def dummy_function(input_text):
20
+ return f"Moshi package version: {moshi.__version__}"
21
 
 
22
  iface = gr.Interface(
23
+ fn=dummy_function,
24
+ inputs="text",
25
+ outputs="text",
26
+ title="Moshi Package Information",
27
+ description="This app displays information about the installed moshi package."
28
  )
29
 
 
30
  iface.launch()