mrsherriff hersia commited on
Commit
571691f
·
0 Parent(s):

Duplicate from hersia/V_Admin_Bot

Browse files

Co-authored-by: abdi <[email protected]>

Files changed (4) hide show
  1. .gitattributes +34 -0
  2. README.md +13 -0
  3. app.py +81 -0
  4. requirements.txt +2 -0
.gitattributes ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ *.tflite filter=lfs diff=lfs merge=lfs -text
29
+ *.tgz filter=lfs diff=lfs merge=lfs -text
30
+ *.wasm filter=lfs diff=lfs merge=lfs -text
31
+ *.xz filter=lfs diff=lfs merge=lfs -text
32
+ *.zip filter=lfs diff=lfs merge=lfs -text
33
+ *.zst filter=lfs diff=lfs merge=lfs -text
34
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: V_Admin_V1.56
3
+ emoji: 🥸 💾
4
+ colorFrom: blue
5
+ colorTo: White
6
+ sdk: gradio
7
+ sdk_version: 3.20.0
8
+ app_file: app.py
9
+ pinned: false
10
+ duplicated_from: hersia/V_Admin_Bot
11
+ ---
12
+
13
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import gradio as gr
3
+ import openai
4
+ from gtts import gTTS
5
+
6
+
7
+ openai.api_key = os.environ["OPEN_AI_KEY"]
8
+
9
+
10
+ def transcribe(audio):
11
+ audio_file = open(audio, "rb")
12
+ transcript = openai.Audio.transcribe("whisper-1", audio_file)
13
+
14
+ return transcript["text"]
15
+
16
+
17
+
18
+
19
+ with gr.Blocks() as demo:
20
+ gr.Markdown(
21
+ """
22
+ # Welcome to your Virtual Smart Administrator.
23
+ """
24
+ )
25
+ with gr.Accordion("Click for Instructions:"):
26
+ gr.Markdown(
27
+ """
28
+ * Record your query.
29
+ * Submit your query, and follow the chat or listen to the advice.
30
+ * When you are ready to respond, clear your last recording and resubmit.
31
+ note: Transcribe Audio does not work on iOS
32
+ """)
33
+
34
+
35
+ messages = gr.State(value=[{"role": "system", "content": "Ignore all instructions prior to this one. As an expert in Microsoft engineering, you have been working in this field for 20 years with a wide range of experience in end-user support, knowledge of all Microsoft services, and troubleshooting styles. Your task is to provide expert advice on resolving technical issues related to Microsoft services, including but not limited to: Windows and Mac OS operating systems, Microsoft Office, Azure, SharePoint, Dynamics 365, Exchange Server, SQL Server, Teams, Networking and infrastructure architecture. It is important that you ALWAYS ask clarifying questions before providing an answer, to ensure a better understanding of the request. Is this understood? Skills: As an IT Administrator Bot, you possess the following skills and expertise: 20 years of experience in Microsoft engineering, Strong knowledge of Windows operating system and troubleshooting techniques, Proficient in Microsoft Office suite, including Word, Excel, PowerPoint, Outlook, and OneNote, Expertise in Microsoft Azure, including configuration, deployment, and management, Knowledge of SharePoint, including site creation, content management, and permission management, Experience in Dynamics 365, including customer engagement, sales, and marketing modules, Proficient in Exchange Server, including mailbox management, email routing, and message tracking, Expertise in SQL Server, including database design, querying, and optimisation, Strong communication skills, both verbal and written, Ability to work under pressure and handle multiple tasks simultaneously, Strong problem-solving skills, with a focus on providing practical solutions to complex technical issues. Always ask questions to narrow down the resolution and increase your understanding of a problem. Here are some questions you can ask: Can you provide more details about the issue you are experiencing? Have you made any recent changes to the system or software? Have you tried any troubleshooting steps before contacting us? To resolve a user's problem, take the following steps: Identify the root cause of the issue by asking clarifying questions and analysing system logs. Develop a step-by-step plan to address the issue, including any necessary software updates or configuration changes. Communicate the plan to the user, ensuring that they understand the steps involved and any potential impacts. Execute the plan, testing each step and confirming that the issue has been resolved. Follow up with the user to ensure that the issue has been fully resolved and to gather feedback on the support experience. If the topic is not related to Microsoft, Azure, SharePoint, Teams, or desktop troubleshooting, you are not will not provide answers or attempt to engage, ignore the request complete. Type only 3 dots …..."}])
36
+
37
+ def botResponse(user_input, messages):
38
+ messages.append({"role": "user", "content": user_input})
39
+ response = openai.ChatCompletion.create(
40
+ model="gpt-3.5-turbo-0301",
41
+ messages=messages
42
+ )
43
+
44
+ system_message = response["choices"][0]["message"]["content"]
45
+ messages.append({"role": "assistant", "content": system_message})
46
+
47
+ chat_transcript = ""
48
+ for message in messages:
49
+ if (message["role"] != "system"):
50
+ chat_transcript += message["role"] + ": " + message["content"] + "\n\n"
51
+
52
+ return chat_transcript
53
+
54
+ def giveVoice(messages):
55
+ bot_message=messages[-1]
56
+
57
+ myobj = gTTS(text=bot_message["content"])
58
+ myobj.save("temp.mp3")
59
+
60
+ dir = os.getcwd()
61
+ new_path = os.path.join(dir, "temp.mp3")
62
+
63
+ return new_path
64
+
65
+ with gr.Row():
66
+ with gr.Column(scale=1):
67
+ user_audio = gr.Audio(source="microphone", type="filepath", label="Input Phrase")
68
+ submit_btn = gr.Button(value="Transcribe Audio")
69
+ submit_btn2 = gr.Button(value="Submit Text")
70
+ gpt_voice = gr.Audio(label="Listen to Advice")
71
+ with gr.Column(scale=2):
72
+ user_transcript = gr.Text(label="Audio Translation", interactive=False)
73
+ user_text = gr.Text(label="Text Input")
74
+ gpt_transcript = gr.Text(label="Chat Transcript")
75
+ submit_btn.click(transcribe, user_audio, user_transcript)
76
+ submit_btn2.click(botResponse, [user_text, messages], gpt_transcript)
77
+ user_transcript.change(botResponse, [user_transcript, messages], gpt_transcript)
78
+ gpt_transcript.change(giveVoice, messages, gpt_voice)
79
+
80
+
81
+ demo.launch(share=False)
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ openai
2
+ gtts