AuRoRA / app.py
Anni123's picture
Duplicate from Anni123/CoT-Adapter
7ead7d1
raw
history blame
1.75 kB
import gradio as gr
from statistics import mean
from torch.utils.data import Dataset
from collections import OrderedDict
import xml.etree.ElementTree as ET
import openai # For GPT-3 API ...
import os
import multiprocessing
import json
import numpy as np
import random
import torch
import torchtext
import re
import random
import time
import datetime
import pandas as pd
import sys
openai.api_key = os.getenv("api_key")
def greet(question):
input = question + '\n\n' + "|step|subquestion|process|result|"
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are a helpful assistant that generate table to solve reasoning problem."},
{"role": "user", "content": input},
]
)
response = response["choices"][0]["message"]["content"]
return "|step|subquestion|process|result|\n" + response
iface = gr.Interface(
fn=greet,
inputs="text",
outputs="text",
title="Tab-CoT: Zero-Shot Tabular Chain-of-Thought",
examples=[
["Tommy is fundraising for his charity by selling brownies for $3 a slice and cheesecakes for $4 a slice. If Tommy sells 43 brownies and 23 slices of cheesecake, how much money does Tommy raise?"],
["Judy teaches 5 dance classes, every day, on the weekdays and 8 classes on Saturday. If each class has 15 students and she charges $15.00 per student, how much money does she make in 1 week?"],
["According to its nutritional info, a bag of chips has 250 calories per serving. If a 300g bag has 5 servings, how many grams can you eat if your daily calorie target is 2000 and you have already consumed 1800 calories?"],
]
)
iface.launch()