Spaces:
Sleeping
Sleeping
HarshanaLF
commited on
Commit
•
5cbc286
1
Parent(s):
9379874
update
Browse files- .github/workflows/check_file_size.yml +16 -0
- .github/workflows/huggingface.yml +20 -0
- app.py +16 -11
.github/workflows/check_file_size.yml
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Check file size
|
2 |
+
on: # or directly `on: [push]` to run the action on every push on any branch
|
3 |
+
pull_request:
|
4 |
+
branches: [main]
|
5 |
+
|
6 |
+
# to run this workflow manually from the Actions tab
|
7 |
+
workflow_dispatch:
|
8 |
+
|
9 |
+
jobs:
|
10 |
+
sync-to-hub:
|
11 |
+
runs-on: ubuntu-latest
|
12 |
+
steps:
|
13 |
+
- name: Check large files
|
14 |
+
uses: ActionsDesk/[email protected]
|
15 |
+
with:
|
16 |
+
filesizelimit: 10485760
|
.github/workflows/huggingface.yml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Sync to Hugging Face hub
|
2 |
+
on:
|
3 |
+
push:
|
4 |
+
branches: [main]
|
5 |
+
|
6 |
+
# to run this workflow manually from the Actions tab
|
7 |
+
workflow_dispatch:
|
8 |
+
|
9 |
+
jobs:
|
10 |
+
sync-to-hub:
|
11 |
+
runs-on: ubuntu-latest
|
12 |
+
steps:
|
13 |
+
- uses: actions/checkout@v3
|
14 |
+
with:
|
15 |
+
fetch-depth: 0
|
16 |
+
lfs: true
|
17 |
+
- name: Push to hub
|
18 |
+
env:
|
19 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
20 |
+
run: git push -f https://HarshanaLF:[email protected]/spaces/HarshanaLF/JULIA main
|
app.py
CHANGED
@@ -38,8 +38,8 @@ def randomize_seed_fn(seed: int) -> int:
|
|
38 |
return seed
|
39 |
|
40 |
system_instructions1 = """
|
41 |
-
[SYSTEM] Answer as
|
42 |
-
Keep conversation friendly, short, clear, and concise.
|
43 |
Avoid unnecessary introductions and answer the user's questions directly.
|
44 |
Respond in a normal, conversational manner while being friendly and helpful.
|
45 |
[USER]
|
@@ -65,8 +65,11 @@ def models(text, model="Mixtral 8x7B", seed=42):
|
|
65 |
output += response.token.text
|
66 |
return output
|
67 |
|
68 |
-
async def respond(audio, model, seed):
|
69 |
-
|
|
|
|
|
|
|
70 |
reply = models(user, model, seed)
|
71 |
communicate = edge_tts.Communicate(reply)
|
72 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as tmp_file:
|
@@ -98,17 +101,19 @@ with gr.Blocks(css="style.css") as demo:
|
|
98 |
value=0,
|
99 |
visible=False
|
100 |
)
|
101 |
-
|
|
|
|
|
102 |
output = gr.Audio(label="AI", type="filepath",
|
103 |
interactive=False,
|
104 |
autoplay=True,
|
105 |
elem_classes="audio")
|
106 |
-
|
107 |
-
|
108 |
-
max_batch_size=10,
|
109 |
fn=respond,
|
110 |
-
inputs=[
|
111 |
-
outputs=[output]
|
|
|
112 |
|
113 |
if __name__ == "__main__":
|
114 |
-
demo.queue(max_size=200).launch()
|
|
|
38 |
return seed
|
39 |
|
40 |
system_instructions1 = """
|
41 |
+
[SYSTEM] Answer as virtual assistant named Julia, made by 'Harshana Lakshara.'
|
42 |
+
Keep the conversation friendly, short, clear, and concise.
|
43 |
Avoid unnecessary introductions and answer the user's questions directly.
|
44 |
Respond in a normal, conversational manner while being friendly and helpful.
|
45 |
[USER]
|
|
|
65 |
output += response.token.text
|
66 |
return output
|
67 |
|
68 |
+
async def respond(audio, text, model, seed):
|
69 |
+
if audio:
|
70 |
+
user = transcribe(audio)
|
71 |
+
else:
|
72 |
+
user = text
|
73 |
reply = models(user, model, seed)
|
74 |
communicate = edge_tts.Communicate(reply)
|
75 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as tmp_file:
|
|
|
101 |
value=0,
|
102 |
visible=False
|
103 |
)
|
104 |
+
input_audio = gr.Audio(label="User (Audio)", sources="microphone", type="filepath", waveform_options=False)
|
105 |
+
input_text = gr.Textbox(label="User (Text)", placeholder="Type your message here...")
|
106 |
+
send_button = gr.Button("Send")
|
107 |
output = gr.Audio(label="AI", type="filepath",
|
108 |
interactive=False,
|
109 |
autoplay=True,
|
110 |
elem_classes="audio")
|
111 |
+
|
112 |
+
send_button.click(
|
|
|
113 |
fn=respond,
|
114 |
+
inputs=[input_audio, input_text, select, seed],
|
115 |
+
outputs=[output]
|
116 |
+
)
|
117 |
|
118 |
if __name__ == "__main__":
|
119 |
+
demo.queue(max_size=200).launch()
|