Spaces:
Build error
Build error
| import gradio as gr | |
| from openai.embeddings_utils import get_embedding, cosine_similarity | |
| from slack_processing.slack_data_prep import FetchSlack, ProcessSlack, CreateEmbeddings | |
| from create_games.create_games_slack import CreateGames | |
| def InitDF(): | |
| global imageDF | |
| imageDF=pd.DataFrame({"role": [""], "content": [""] }) | |
| def UpdateArtSetting(setting): | |
| global settingOptions | |
| settingOptions.value=setting | |
| def UpdateArtStyle(art): | |
| global artOptions | |
| artOptions.value=art | |
| def Generate(imageDescription): | |
| global artOptions, settingOptions | |
| return image_generation.GenerateImages(imageDescription, artOptions, settingOptions) | |
| def FetchSlackJSON(): | |
| result=FetchSlack() | |
| print("slack fetch") | |
| print (result) | |
| return result | |
| def InitProcess(): | |
| result=ProcessSlack() | |
| print("slack processed") | |
| print (result) | |
| return result | |
| def FetchEmbeddings(): | |
| result = CreateEmbeddings() | |
| print("fetch embeddings") | |
| print(result) | |
| return result | |
| def FetchGames(): | |
| result = CreateGames() | |
| print("result") | |
| print(result) | |
| return result | |
| with gr.Blocks() as ui1: | |
| with gr.Row(): | |
| b1 = gr.Button("Fetch Slack JSON") | |
| with gr.Row(): | |
| with gr.Column(scale=1, min_width=600): | |
| df1 =gr.Dataframe(type="pandas") | |
| b1.click(FetchSlackJSON,outputs=df1) | |
| with gr.Blocks() as ui2: | |
| with gr.Row(): | |
| b2 = gr.Button("Process & Tag Slack Data") | |
| with gr.Row(): | |
| with gr.Column(scale=1, min_width=600): | |
| df2 =gr.Dataframe(type="pandas") | |
| b2.click(ProcessSlack,outputs=df2) | |
| with gr.Blocks() as ui3: | |
| with gr.Row(): | |
| b3 = gr.Button("Create Embeddings") | |
| with gr.Row(): | |
| with gr.Column(scale=1, min_width=600): | |
| df3 =gr.Dataframe(type="pandas") | |
| b3.click(FetchEmbeddings,outputs=df3) | |
| with gr.Blocks() as ui4: | |
| with gr.Row(): | |
| b4 = gr.Button("Find Games") | |
| with gr.Row(): | |
| with gr.Column(scale=1, min_width=600): | |
| df4 =gr.Dataframe(type="pandas") | |
| b4.click(FetchGames,outputs=df4) | |
| demo = gr.TabbedInterface([ui1,ui2,ui3,ui4], ("Fetch Slack", "Process & Tag", "Create Embeddings", "Find Games")) | |