File size: 951 Bytes
b397a75
 
 
 
55b6c6c
b397a75
55b6c6c
 
b397a75
 
55b6c6c
b397a75
 
55b6c6c
b397a75
55b6c6c
 
 
 
 
b397a75
55b6c6c
b397a75
55b6c6c
 
 
b397a75
 
55b6c6c
b397a75
 
55b6c6c
b397a75
55b6c6c
 
 
 
b397a75
55b6c6c
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
import requests
import json
import gradio as gr

url = "https://huggingface.co/curiouscurrent/omnicode"

headers = {
    'Content-Type': 'application/json'
}

history = []

def generate_response(prompt):
    global history
    history.append(prompt)
    final_prompt = "\n".join(history)
    data = {
        "model": "curiouscurrent/omnicode",
        "prompt": final_prompt,
        "stream": False
    }
    response = requests.post(url, headers=headers, data=json.dumps(data))

    if response.status_code == 200:
        response = response.json()
        actual_response = response['response']
        return actual_response
    else:
        print("error:", response.text)


interface = gr.Interface(
    fn=generate_response,
    inputs=gr.Textbox(lines=4, placeholder="Enter your Prompt"),
    outputs="text",
    title="Omnicode",
    description="A code generation model trained on a variety of programming languages."
)
interface.launch()