Spaces:
Sleeping
Sleeping
File size: 3,153 Bytes
dacd9af 8532693 dacd9af 8532693 7a8857b 8532693 dacd9af 8532693 83d915d 8532693 83d915d 8532693 f7e0baf 8532693 dacd9af 8532693 dacd9af 8532693 f7e0baf 8532693 dacd9af 8532693 dacd9af 8532693 dacd9af 8532693 dacd9af 8532693 | 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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | import gradio as gr
def message():
return "🚧 Under Construction 🚧\n\nCheck back soon!"
demo = gr.Interface(
fn=message,
inputs=[],
outputs=gr.Textbox(label="Status"),
title="Site Under Construction",
description="This application is currently being updated. Please check back later!"
)
demo.launch()
# import gradio as gr
# import numpy as np
# import pandas as pd
# import tensorflow as tf
# import joblib
# from tensorflow.keras.models import load_model
# # Load the trained LSTM model
# model = load_model("lstm_gru_model5.h5")
# # Load the MinMaxScaler
# scaler = joblib.load("forex_scaler222.pkl")
# def preprocess_input(data):
# """Preprocess input data for LSTM model."""
# if len(data) < 60:
# mean_value = np.mean(data) # Compute mean of given prices
# data = data + [mean_value] * (60 - len(data)) # Fill missing spots
# data = np.array(data).reshape(1, -1) # Reshape for MinMaxScaler
# scaled_data = scaler.transform(data) # Scale the input
# return scaled_data.reshape(1, 60, 1) # Reshape for LSTM
# def predict_forex(prices):
# """Predict the next forex price based on the input sequence."""
# try:
# input_data = [float(price) for price in prices.split(",")]
# # Ensure enough input data
# if len(input_data) < 60:
# return "Please provide at least 60 previous forex prices."
# # Use last 60 prices
# preprocessed_data = preprocess_input(input_data[-60:])
# prediction = model.predict(preprocessed_data)
# # Convert back to original scale
# predicted_price = scaler.inverse_transform(prediction)[0][0]
# return f"Predicted Next Price: {predicted_price:.5f}"
# except Exception as e:
# return f"Error: {str(e)}"
# def batch_predict(file):
# """Batch prediction for CSV files."""
# try:
# df = pd.read_csv(file)
# if "prices" not in df.columns:
# return "CSV must have a 'prices' column with historical data."
# df["predictions"] = df["prices"].rolling(window=10).apply(lambda x: predict_forex(",".join(map(str, x))) if len(x) == 10 else None)
# return df.dropna()
# except Exception as e:
# return f"Error: {str(e)}"
# # Gradio UI
# demo = gr.Interface(
# fn=predict_forex,
# inputs=gr.Textbox(label="Enter last 10 forex prices (comma-separated)"),
# outputs=gr.Textbox(label="Predicted Next Price"),
# title="Forex Price Predictor",
# description="Enter the last 10 forex prices to predict the next price. Upload CSV for batch predictions.",
# examples=[
# ["1.2345,1.2350,1.2360,1.2370,1.2380,1.2390,1.2400,1.2410,1.2420,1.2430"]
# ],
# allow_flagging="never"
# )
# batch_demo = gr.Interface(
# fn=batch_predict,
# inputs=gr.File(label="Upload CSV"),
# outputs=gr.Dataframe(label="Predictions"),
# title="Batch Prediction",
# description="Upload a CSV with a 'prices' column for batch predictions."
# )
# gr.TabbedInterface([demo, batch_demo], ["Single Prediction", "Batch Prediction"]).launch()
|