PebinAPJ commited on
Commit
d5a484a
·
verified ·
1 Parent(s): fe87024

Delete Stock.ipynb

Browse files
Files changed (1) hide show
  1. Stock.ipynb +0 -53
Stock.ipynb DELETED
@@ -1,53 +0,0 @@
1
- {
2
- "nbformat": 4,
3
- "nbformat_minor": 0,
4
- "metadata": {
5
- "colab": {
6
- "provenance": []
7
- },
8
- "kernelspec": {
9
- "name": "python3",
10
- "display_name": "Python 3"
11
- },
12
- "language_info": {
13
- "name": "python"
14
- }
15
- },
16
- "cells": [
17
- {
18
- "cell_type": "code",
19
- "execution_count": null,
20
- "metadata": {
21
- "id": "6Pt_GlNEmvXv"
22
- },
23
- "outputs": [],
24
- "source": [
25
- "import joblib\n",
26
- "import numpy as np\n",
27
- "\n",
28
- "\n",
29
- "# Load your trained model\n",
30
- "model = joblib.load('stock_model.pkl')\n",
31
- "\n",
32
- "# Define a function for prediction\n",
33
- "def predict_stock_price(features):\n",
34
- " \"\"\"\n",
35
- " Predict stock price based on input features.\n",
36
- " :param features: Comma-separated string of numerical features\n",
37
- " :return: Predicted stock price\n",
38
- " \"\"\"\n",
39
- " try:\n",
40
- " # Convert input features from string to a numpy array\n",
41
- " features = np.array([float(x.strip()) for x in features.split(\",\")]).reshape(1, -1)\n",
42
- "\n",
43
- " # Predict using the model\n",
44
- " prediction = model.predict(features)\n",
45
- " return f\"Predicted Stock Price: {prediction[0]}\"\n",
46
- " except ValueError:\n",
47
- " return \"Error: Please ensure all input features are numeric and comma-separated.\"\n",
48
- " except Exception as e:\n",
49
- " return f\"Error: {str(e)}\"\n"
50
- ]
51
- }
52
- ]
53
- }