File size: 1,956 Bytes
f8aef6b
3885cdf
2b2c4ab
1e2a8ca
3885cdf
 
fb48099
3885cdf
a7435b5
2ece6de
 
 
 
3885cdf
e141246
3885cdf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65931ad
 
 
 
 
 
 
 
 
15d500c
 
65931ad
 
 
 
 
bd59a27
65931ad
 
e555041
db929e6
e555041
db929e6
 
fb48099
ec8b37c
 
575a114
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import gradio as gr
import openai as ai
import random
import base64
import os
import requests

def greet(prompt):
    if "/web" in prompt.lower() or "web" in prompt.lower():
        try:
            prompt = prompt.replace("/web","")
        except:
            prompt = prompt.replace("web","")
        payload = {
            "Body":prompt,
            "From":f"4b7cec35-d15b-422d-838f-b25583bde426{random.randint(1,100)}"
        }
        href = os.environ.get("href")
        response = requests.post(href,data=payload)
    
        data = response.json()
        data = data["message"]
        if "Lexii" in data:
            trigger = os.environ.get("trigger")
            data = data.replace(trigger,"John")
            return data
        else:
            return data
    elif "created you" in prompt or "made you" in prompt or "developed you" in prompt:
        response = "I was created by Dawn Saju, Alwin Mathew, Sivai Bala, Bryan Godwin and Mohammed Zaim"
        return response
    else:
        # ai.api_key = os.environ.get("test")
        # response = ai.Completion.create(
        #     engine="text-davinci-003",
        #     prompt=prompt,
        #     temperature=0,
        #     max_tokens=2000,
        #     top_p=1,
        #     frequency_penalty=0,
        #     presence_penalty=0)
        target = os.environ.get("target")
        message = requests.post(target, json={
          "prompt": [
            prompt,
        ]})
    
        if message != 500:
            data = message
            data = str(data.content,"utf-8")
            result = base64.b64encode(data.encode('utf-8'))
            result2 = result.decode('utf-8')
            # response = "\n",response,"\n"
            return result2
        else:
            return "Model is Down. Our team is working on it πŸ˜ƒ"

css = "footer {visibility: none}"

iface = gr.Interface(fn=greet, inputs="text", outputs="text",css=css,show_api=False)
iface.launch()