Warlord-K commited on
Commit
2694c52
0 Parent(s):

Duplicate from Warlord-K/IITI-GPT

Browse files
Files changed (5) hide show
  1. .gitattributes +35 -0
  2. README.md +14 -0
  3. abc.json +3 -0
  4. app.py +59 -0
  5. requirements.txt +4 -0
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: IITI GPT
3
+ emoji: 💻
4
+ colorFrom: green
5
+ colorTo: gray
6
+ sdk: gradio
7
+ sdk_version: 3.39.0
8
+ app_file: app.py
9
+ pinned: false
10
+ license: openrail
11
+ duplicated_from: Warlord-K/IITI-GPT
12
+ ---
13
+
14
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
abc.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "text":"What is your Name?"
3
+ }
app.py ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from gradio_client import Client
2
+ from gtts import gTTS
3
+ import gradio as gr
4
+
5
+ client = Client("https://sanchit-gandhi-whisper-large-v2.hf.space/")
6
+ chat_client = Client("https://mosaicml-mpt-30b-chat.hf.space/", serialize = False)
7
+ retrieval = Client("https://warlord-k-iiti-similarity.hf.space/")
8
+
9
+ init_prompt ="## Instruction: You are an AI language model and must return truthful responses as per the information. Do not answer with any information which isn't completely verified and correct. Do not lie. Do not present information where you don't know the answer. Do not include incorrect extra information. Your name is IITIGPT. You are a helpful and truthful chatbot. You can help answer any questions about the IIT Indore campus."
10
+ info="Information: \n"
11
+ q_prompt="\n ##Instruction: Please provide an appropriate response to the following in less than 3 lines: \n"
12
+ chatbot = [["", None]]
13
+
14
+ def file_to_text(audio_fpath):
15
+
16
+ result = client.predict(
17
+ audio_fpath,
18
+ "transcribe", # str in 'Audio input' Radio component
19
+ api_name="/predict"
20
+ )
21
+ return result
22
+
23
+ def answer_question(question):
24
+ global chatbot
25
+ information = retrieval.predict(question, api_name = "/predict")
26
+ answer=chat_client.predict(
27
+ info +information+question, # str in 'Type an input and press Enter' Textbox component
28
+ chatbot,
29
+ fn_index=1
30
+ )
31
+ chatbot = answer[1]
32
+ return answer[1][0][1]
33
+
34
+
35
+ def text_to_file(text):
36
+ tts = gTTS(text, lang = "en")
37
+ tts.save("abc.mp3")
38
+ return "abc.mp3"
39
+
40
+ def main(filename):
41
+ question = file_to_text(filename)
42
+ print(question)
43
+ answer = answer_question(question)
44
+ print(answer)
45
+ output = text_to_file(answer)
46
+ return None, output
47
+
48
+ with gr.Blocks() as demo:
49
+ gr.Markdown("# IITI GPT: A Helper Chabot for the Students of IIT Indore which can answer any query related to IIT Indore, or any query in general.")
50
+ gr.Markdown("## This is Made by the Students of The Cynaptics Club and The Robotics Club")
51
+ gr.Markdown("## See the Robot in Action on LinkedIn of [Robotics Club](https://www.linkedin.com/company/robotics-club-iit-indore/) and [Cynaptics Club](https://www.linkedin.com/company/cynaptics-club-iit-indore)")
52
+ with gr.Row():
53
+ input = gr.Audio(source = "microphone", type = "filepath", label = "Input")
54
+ output = gr.Audio(type = "filepath", label = "Output", autoplay = True)
55
+ btn = gr.Button("Run")
56
+ btn.click(main, [input], [input, output])
57
+
58
+ if __name__ == "__main__":
59
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ hugchat
2
+ gradio
3
+ gradio_client
4
+ gtts