Spaces:
Runtime error
Runtime error
File size: 1,028 Bytes
c9e8e4a 3bce3fb a16fa71 41d27ac c9e8e4a fa5e188 7c0d726 b6b5314 fa5e188 c9e8e4a f4313df c9e8e4a 7c0d726 41d27ac 7c0d726 f7b6a4b 7c0d726 5740d40 c5fafcd b6b5314 1d384f8 b6b5314 |
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 |
import json
import pandas as pd
import requests
from multiprocessing import Pool
from functools import partial
import streamlit as st
GITHUB_CODE = "https://huggingface.co./datasets/lvwerra/github-code"
INCODER_IMG = (
"https://huggingface.co./datasets/loubnabnl/repo-images/raw/main/incoder.png"
)
MODELS = ["CodeParrot", "InCoder"]
@st.cache()
def load_examples():
with open("utils/examples.json", "r") as f:
examples = json.load(f)
return examples
def generate_code(model_name, gen_prompt, max_new_tokens, temperature, seed):
url = (
f"https://hf.space/embed/loubnabnl/{model_name.lower()}-subspace/+/api/predict/"
)
r = requests.post(
url=url, json={"data": [gen_prompt, max_new_tokens, temperature, seed]}
)
generated_text = r.json()["data"][0]
return generated_text
st.set_page_config(page_icon=":laptop:", layout="wide")
# Introduction
st.title("Code generation with 🤗")
with open("utils/intro.txt", "r") as f:
intro = f.read()
st.markdown(intro)
|