Spaces:
Paused
Paused
Commit
Β·
e3ce00c
1
Parent(s):
228c685
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import platform
|
| 2 |
+
import pathlib
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
import gradio as gr
|
| 6 |
+
import random
|
| 7 |
+
import time
|
| 8 |
+
from gradio_client import Client
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
plt = platform.system()
|
| 12 |
+
pathlib.WindowsPath = pathlib.PosixPath
|
| 13 |
+
|
| 14 |
+
api = os.environ['API']
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def chat(message,history):
|
| 18 |
+
client = Client(api)
|
| 19 |
+
result = client.predict(
|
| 20 |
+
message,
|
| 21 |
+
api_name="/chat"
|
| 22 |
+
)
|
| 23 |
+
return result
|
| 24 |
+
|
| 25 |
+
description='''
|
| 26 |
+
<br/>
|
| 27 |
+
π AI Chat Bot is available worldwide in over **160 languages**.<br/>
|
| 28 |
+
π¬ This space is powered by **Huggingface Hosting**.<br/>
|
| 29 |
+
π This space runs **very fast** even on **CPU**.<br/>
|
| 30 |
+
<a href="https://www.facebook.com/MohammedAlakras">π Facebook Account. </a><br/>
|
| 31 |
+
<a href="https://github.com/mohammedalakhras/">π Github Account. </a><br/>
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
'''
|
| 35 |
+
gr.ChatInterface(chat, title='Mohammed Alakhras AI Chat Bot π¬', description=description).launch(share=True)
|